/*
 * This class creates the PPM Signal
 * Aileron  - Roll
 * Elevator - Pitch  
 * Rudder   - Yaw
 */
void ppmoutput(){
  int used = 0;
  
  // Channel 1 - Throttle
  digitalWrite( pinPPM, LOW );
  delayMicroseconds( lowPPM );
  digitalWrite( pinPPM, HIGH );
  delayMicroseconds( pulseThrottle );      
  used++;

  // Channel 2 - Aeleron
  digitalWrite( pinPPM, LOW );
  delayMicroseconds( lowPPM );
  digitalWrite( pinPPM, HIGH );
  delayMicroseconds( pulseYaw );      
  used++;

  // Channel 3 - Elevator 
  digitalWrite( pinPPM, LOW );
  delayMicroseconds( lowPPM );
  digitalWrite( pinPPM, HIGH );
  delayMicroseconds( pulsePitch );    
  used++;

  // Channel 4 - Rudder
  digitalWrite( pinPPM, LOW );
  delayMicroseconds( lowPPM );
  digitalWrite( pinPPM, HIGH );
  delayMicroseconds( pulseRoll );
  used++;

  // Channel 5 - AUX1
  digitalWrite( pinPPM, LOW );
  delayMicroseconds( lowPPM );
  digitalWrite( pinPPM, HIGH );
  delayMicroseconds( pulseAux1 );
  used++;
  
  // Fill the not set channels with min ppm pulse
  while( used++ < channels ){
    digitalWrite( pinPPM, LOW );
    delayMicroseconds( lowPPM );
    digitalWrite( pinPPM, HIGH );
    delayMicroseconds( pulseMin );
  }

  // Synchro pulse
  digitalWrite( pinPPM, LOW );
  delayMicroseconds( lowPPM );
  digitalWrite( pinPPM, HIGH );
}


